import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { createHtmlPlugin } from "vite-plugin-html";
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd())

  return {
    plugins: [
      vue(),
      createHtmlPlugin({
        inject: {
          data: {
            gmapkey: env.VITE_GOOGLE_MAP_KEY
          },
        },
      }),
    ],
    resolve: {
      alias: [{ find: "@", replacement: resolve(__dirname, "src") }]
    },
    server: {
      host: true
    }
  }
});
